﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Transitions;

namespace UIT_CV_Management
{
    public partial class MainForm : Form
    {
        public MainForm()
        {
            InitializeComponent();
        }

        public void InitLanguage() {
            this.Text = Language._("MAIN_FORM_TITLE") + " - " + currentUser.logedinUser.Username; 
            lblTitle.Text = Language._("MAIN_FORM_TITLE_LBL");
            btnLapHoSo.Text = Language._("MAIN_FORM_NEW_CV_BTN");
            btnTraCuu.Text = Language._("MAIN_FORM_LOOK_UP_BTN");
            btnThongKe.Text = Language._("MAIN_FORM_STAT_BTN");
            btnCaiDat.Text = Language._("MAIN_FORM_SETTINGS_BTN");
            btnTaiKhoan.Text = Language._("MAIN_FORM_ACCOUNT_BTN");
            btnThoat.Text = Language._("MAIN_FORM_EXIT_BTN");
            
        }

        private void btnLapHoSo_Click(object sender, EventArgs e)
        {
            LapHoSoForm lhsForm = new LapHoSoForm();
            lhsForm.ShowDialog();
        }

        private void btnTraCuu_Click(object sender, EventArgs e)
        {
            LookupForm lookupform = new LookupForm();
            lookupform.ShowDialog();
        }

        private void btnThongKe_Click(object sender, EventArgs e)
        {
            StatForm stsfrm = new StatForm();
            stsfrm.ShowDialog();
        }

        private void btnCaiDat_Click(object sender, EventArgs e)
        {
            SettingsForm settingform = new SettingsForm();
            Int32 TotalWidth = this.Width + settingform.Width;
            Int32 CurrentLeft = this.Left;
            Int32 iMoveLeft = (Screen.PrimaryScreen.Bounds.Width - TotalWidth) / 2;
            Transition.run(this, "Left", iMoveLeft, new TransitionType_EaseInEaseOut(200));
            settingform.Left = iMoveLeft + this.Width;
            settingform.Top = this.Top;
            if (settingform.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                InitLanguage();
            Transition.run(this, "Left", CurrentLeft, new TransitionType_EaseInEaseOut(200));
        }

        private void btnQuanLyHoSo_Click(object sender, EventArgs e)
        {
            AccountForm accountform = new AccountForm();
            Int32 TotalWidth = this.Width + accountform.Width;
            Int32 CurrentLeft = this.Left;
            Int32 iMoveLeft = (Screen.PrimaryScreen.Bounds.Width - TotalWidth) / 2;
            Transition.run(this, "Left", iMoveLeft, new TransitionType_EaseInEaseOut(200));
            accountform.Left = iMoveLeft + this.Width;
            accountform.Top = this.Top;
            accountform.ShowDialog();
            Transition.run(this, "Left", CurrentLeft, new TransitionType_EaseInEaseOut(200));
        }

        private void btnThoat_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        private void MainForm_FormClosed(object sender, FormClosedEventArgs e)
        {
            Application.Exit();
        }

        private void MainForm_Load(object sender, EventArgs e)
        {
            InitLanguage();
        }
    }
}
